<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Manager_model extends MY_Model
{
	/**
	 * 获取管理员列表
	 * return array
	 */
	public function get_manager_info($school_id)
	{
	    $this->db->where("id",$school_id);
		$query = $this->db->get('ym_admin_user');
		
		return $query->row_array();
	}
	
	/**
	 * 编辑管理员
	 * @param number $id
	 * @param array $data
	 * @return int
	 */
	public function edit_manager($id=0, $data=array())
	{
		$this->db->where('id', $id);
		
		$res = $this->db->update('ym_admin_user', $data);
		
		return $res;
	}
    public function check_email($id,$email)
    {
        $sql = "SELECT * FROM ym_admin_user WHERE id != {$id} AND email = '$email'";
        $query = $this->db->query($sql);
        return $query->num_rows();
    }
    public function check_username($id,$username)
    {
        $sql = "SELECT * FROM ym_admin_user WHERE id != {$id} AND username = '$username'";
        $query = $this->db->query($sql);
        return $query->num_rows();
    }
}

/* End of file manager_model.php */
/* Location: ./application/models/luckycat/manager_model.php */
